package com.itrip.biz.controller;

import com.itrip.beans.domain.ItripHotelRoom;
import com.itrip.beans.dto.Dto;
import com.itrip.beans.vo.HotelRoomParam;
import com.itrip.beans.vo.ItripHotelRoomVo;
import com.itrip.biz.service.HotelRoomService;
import com.itrip.utils.DtoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/hotelroom")
public class HotelRoomController {

    @Autowired
    private HotelRoomService hotelRoomService;

    @PostMapping("/queryhotelroombyhotel")
    public Dto queryhotelroombyhotel(@RequestBody HotelRoomParam hotelRoomParam){
        List<List<ItripHotelRoomVo>> hotelRoomVOList = null;
        List<ItripHotelRoomVo> originalRoomList = hotelRoomService.queryhotelroombyhotel(hotelRoomParam);
        hotelRoomVOList = new ArrayList();
        for(ItripHotelRoomVo roomVO : originalRoomList){
            List<ItripHotelRoomVo> tempList = new ArrayList<ItripHotelRoomVo>();
            tempList.add(roomVO);
            hotelRoomVOList.add(tempList);
        }
        return DtoUtil.returnSuccess("获取成功",hotelRoomVOList);
    }
}
